package IO.charSet;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class demo1 {
    public static void main(String[] args) throws IOException {

        FileInputStream fis = new FileInputStream("./test/k.txt");
        FileOutputStream fos = new FileOutputStream("./test/hh.txt");
        //读多少字节
        int len;
        //每次读2个字节
        byte[] bytes = new byte[2];
        while ((len = fis.read(bytes)) != -1) {//读到末端了，len就返回-1，len读取的字节是根据数组的长度来的
            //把从./test/k.txt路径下的读取的文件拷贝到./test/hh.txt下
            fos.write(bytes, 0, len);
        }
    }
}
